package b1.project.order.controller;

import b1.project.order.entity.OrderEntity;
import b1.project.order.properties.OrderProperties;
import b1.project.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author sun
 * @date sun09点42分
 */
@RequestMapping("/order")
@RestController
public class OrderController {
    @Autowired
    OrderService orderService;
    @Autowired
    OrderProperties orderProperties;


    /**
     * 查询商品
     */
    @PostMapping("/create/{productId}")
    public OrderEntity create(@PathVariable("productId") String productId) {
        return orderService.create(productId);
    }

    /**
     * config
     */
    @GetMapping("/config")
    public String config() {
        return "timeout:" + orderProperties.getTimeout() ;
    }
}
